Purpose
Consume a simple OData service and display the result in a table

Main points

  • Build up the URL for the OData service

  • Use CopyText to receive the OData response (JSON format) in a GuiXT text variable

  • Call up a JavaScript routine via CallJS to transform the JSON format into GuiXT variables

  • Display the result as a table, using Table and Column statements

GuiXT Script

GuiXT
// Build up OData URL (here: OData Test service)
Set V[url] _
  "http://services.odata.org/V4/Northwind/Northwind.svc/Customers"

// table to be filled via OData
CreateTable V[customertable] company city country

// Read Northwind customers via OData service
CopyText fromFile="&V[url]" toText="cust"

// Fill table 
CallJS odata_customers  "customertable" "cust"

// Display customer table
Table (1,1) (15,101) title="Northwind Customers" -singleRowSelection   _
  name="customertable" fixedColumns=3

Column "Company" size=40 name="company"
Column "City" size=30 name="city"
Column "Country" size=20 name="country"


JavaScript

JavaScript

Result

Components
InputAssistant + GuiXT Controls